home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0052_Access Video Bios Fonts.pas < prev    next >
Pascal/Delphi Source File  |  1993-07-16  |  3KB  |  94 lines

  1. ===========================================================================
  2.  BBS: Canada Remote Systems
  3. Date: 07-02-93 (14:00)             Number: 29054
  4. From: SEAN PALMER                  Refer#: NONE
  5.   To: FRANCIS BURIANEK              Recvd: NO  
  6. Subj: DOS FONT                       Conf: (1221) F-PASCAL
  7. ---------------------------------------------------------------------------
  8. FB>Would You know, where the Video Bios Fonts are located at? (address),
  9. FB>or a way to access using an interrupt?
  10.  
  11. I pulled this off the echo a while back...
  12.  
  13. Type
  14.   FontBlock    = 0..7;
  15.   CharSetType  = (INT1F, INT43, ROM8x14, ROM8x8lo, ROM8x8hi, ROM9x14,
  16.                  ROM8x16, ROM9x16);
  17.  
  18. { Get a pointer to one of the eight resident VGA fonts }
  19.  
  20. Function GetFontPtr(charset : CharSetType) : Pointer; Assembler;ASM
  21.         MOV    BH, charset
  22.         MOV    AX,$1130
  23.         INT    $10
  24.         MOV    DX, ES
  25.         XCHG   AX, BP
  26. end;
  27.  
  28. { Get font block index of current (resident) and alternate character set.
  29.   Up to two fonts can be active at the same time }
  30.  
  31. Procedure GetFontBlock(Var primary, secondary : FontBlock); Assembler;ASM
  32.   { Get character map select register:
  33.     (VGA sequencer port 3C4h/3C5h index 3)
  34.  
  35.     7  6  5  4  3  2  1  0
  36.           |  |  |  |  |  |
  37.           |  |  |  |  +--+--   Primary font   (lower 2 bits)
  38.           |  |  +--+--------   Secondary font (lower 2 bits)
  39.           |  +--------------   Primary font   (high bit)
  40.           +-----------------   Secondary font (high bit)     }
  41.  
  42.         MOV     AL, 3
  43.         MOV     DX,$3C4
  44.         OUT     DX, AL
  45.         INC     DX
  46.         IN      AL, DX
  47.         MOV     BL, AL
  48.         PUSH    AX
  49.   { Get secondary font number: add up bits 5, 3 and 2 }
  50.         SHR     AL, 1
  51.         SHR     AL, 1
  52.         AND     AL, 3
  53.         TEST    BL,$20
  54.         JZ      @1
  55.         ADD     AL, 4
  56. @1:     LES     DI, secondary
  57.         STOSB
  58.   { Get primary font number: add up bits 4, 1 and 0 }
  59.         POP     AX
  60.         AND     AL, 3
  61.         TEST    BL,$10
  62.         JZ      @2
  63.         ADD     AL, 4
  64. @2:     LES     DI, primary
  65.         STOSB
  66. end;
  67.  
  68. { Store the font block index }
  69.  
  70. Procedure SetFontBlock(primary, secondary : FontBlock); Assembler;
  71. Const
  72.   MapPrimTable : Array[0..7] of Byte = ($00, $01, $02, $03,$10, $11, $12, $13);
  73.   MapSecTable  : Array[0..7] of Byte = ($00, $04, $08, $0C,$20, $24, $28, $2C);
  74. ASM
  75.         MOV     AL, primary
  76.         LEA     BX, MapPrimTable
  77.         XLAT
  78.         MOV     AH, AL
  79.         MOV     AL, secondary
  80.         LEA     BX, MapSecTable
  81.         XLAT
  82.         ADD     AL, AH
  83.         MOV     BL, AL
  84. { Set block specifier }
  85.         MOV     AX,$1103
  86.         INT     $10
  87. end;
  88.  
  89.  
  90.  * OLX 2.2 * If at first you succeed, hide your astonishment...
  91.  
  92. --- Maximus 2.01wb
  93.  * Origin: >>> Sun Mountain BBS <<< (303)-665-6922 (1:104/123)
  94.